package com.snails.mall.elasticsearch.biz.admin.controller;

import com.ruyuan.little.project.common.dto.CommonResponse;
import com.ruyuan.little.project.common.dto.TableData;
import com.snails.mall.elasticsearch.biz.admin.dto.AdminGoodsStoreDTO;
import com.snails.mall.elasticsearch.biz.admin.entity.AdminGoodsStore;
import com.snails.mall.elasticsearch.biz.admin.service.AdminGoodsStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gaoxu
 * date: Created on 2021/11/8 下午3:53
 */
@RestController
@RequestMapping(value = "/admin/goods/store")
public class AdminGoodsStoreController {

    @Autowired
    private AdminGoodsStoreService adminGoodsStoreService;


    /**
     * 根据店铺名称获取店铺列表
     *
     * @param adminGoodsStoreDTO
     * @return
     */
    @RequestMapping(value = "list", method = RequestMethod.POST)
    public CommonResponse<TableData<AdminGoodsStore>> getStorePageByStoreName(@RequestBody AdminGoodsStoreDTO adminGoodsStoreDTO) {
        //return adminGoodsStoreService.getStorePageByStoreNameFromDB(adminGoodsStoreDTO);

        // 查询es
        return adminGoodsStoreService.getStorePageByStoreNameFromEs(adminGoodsStoreDTO);
    }
}
